#ifndef __UMSP_H__
#define __UMSP_H__

#ifdef _WIN32
#define EXPORT __declspec(dllexport)
#define FUNC_CALL_TYPE __stdcall 
#else
#define EXPORT __attribute__((visibility("default")))
#define FUNC_CALL_TYPE  
#endif

#include <string.h>

extern "C"
{

    typedef struct Packet
    {
        int size;
        char buf[2048];
        Packet() {
            memset(this, 0, sizeof(Packet));
        }
    }Packet;

    EXPORT typedef  void(FUNC_CALL_TYPE *Dispatcher)(Packet* packet);
    EXPORT int FUNC_CALL_TYPE UMSP_sendMessage(char* buf, int bufLen);

    EXPORT int FUNC_CALL_TYPE UMSP_init(char* HOST, int PORT);

    EXPORT int FUNC_CALL_TYPE UMSP_setPacketHandler(Dispatcher  handler);

    EXPORT int FUNC_CALL_TYPE UMSP_uninit();

    EXPORT int FUNC_CALL_TYPE UMSP_getNetWorkState();
    EXPORT int FUNC_CALL_TYPE main1();
}
#endif
